package com.wwj.mapper;

import com.github.pagehelper.Page;
import com.wwj.pojo.dto.OrderPageQueryDTO;
import com.wwj.pojo.entity.Order;
import com.wwj.pojo.vo.OrderVO;
import com.wwj.pojo.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrderMapper {
    //插入预约单

    void insertOrder(Order order);


    //分页查询
    Page<OrderVO> pageQuery(OrderPageQueryDTO orderPageQueryDTO);
    //用户端分页查询
    Page<OrderVO> pageQueryUser(OrderPageQueryDTO orderPageQueryDTO);
    //修改预约单
    void update(Order order);


    //根据id查询预约单
    @Select("select * from `order` where id=#{id}")
    Order selectById(Long id);

    //根据id删除预约单
    @Delete("delete from `order` where id=#{id}")
    void deleteById(Long id);

    //查询超时订单
    @Select("select * from `order` where status=#{status} and create_time < #{localDateTime}")
    List<Order> getByStatusAndOrderTimeLT(Integer status, LocalDateTime localDateTime);
}
